home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
Source
/
MacStarter (THINK C 5.0⁄6.0)
/
other applicationProcs files
/
uncommentedProcs.c
< prev
Wrap
C/C++ Source or Header
|
1992-10-06
|
3KB
|
135 lines
#include "globals-MacStarter.h"
long gEventWaitTime = 10;
MenuHandle editMenu, fileMenu;
void InitApplication(void);
void UpdateMenus(void);
void DoEditMenu(int itemNum);
void DoFileMenu(int itemNum, int* done);
void DoOtherMenu(int menuID, int itemNum);
void ApplicationIdle(void);
void CleanUpApplication(void);
void AboutBox(void);
void DoNewCommand(void);
class myWindow : public xWindow {
virtual void SetDefaults(void);
virtual void OpenInRect(Str255 title, int left, int top, int right, int bottom);
virtual short Close(void);
virtual void doKey(char ch);
virtual void doContentClick(Point localPt);
virtual void adjustToNewSize(void);
virtual void doRedraw(Rect* badRect);
virtual void doHScroll(int dh);
virtual void doVScroll(int dv);
virtual void doActivate(int active);
};
void myWindow::SetDefaults(void) {
inherited::SetDefaults();
}
void myWindow::OpenInRect(Str255 title, int left, int top, int right, int bottom) {
inherited::OpenInRect(title,left,top,right,bottom);
}
short myWindow::Close(void) {
inherited::Close();
}
void myWindow::doKey(char ch) {
}
void myWindow::doContentClick(Point localPt) {
}
void myWindow::doRedraw(Rect* badRect){
}
void myWindow::adjustToNewSize(void) {
inherited::adjustToNewSize();
}
void myWindow::doHScroll(int dh) {
inherited::doHScroll(dh);
}
void myWindow::doVScroll(int dv) {
inherited::doVScroll(dv);
}
void myWindow::doActivate(int active) {
inherited::doActivate(active);
}
void InitApplication(void) {
MenuHandle appleMenu;
fileMenu = GetMHandle(2);
editMenu = GetMHandle(3);
appleMenu = GetMHandle(1);
SetItem(appleMenu,1,"\pAbout Generic...");
DoNewCommand();
}
void UpdateMenus(void) {
short i;
WindowPtr win;
xWindow *xwin;
win = FrontWindow();
if ( win && ((WindowPeek)win)->windowKind < 0 ) { // Desk accessory window
EnableItem(editMenu,1);
for (i=3; i<7; i++)
EnableItem(editMenu,i);
}
else {
DisableItem(editMenu,1);
for (i=3; i<7; i++)
DisableItem(editMenu,i);
}
if (win && xWindow::Window2XWindow(win,&xwin)) {
EnableItem(fileMenu,2); // Close
}
else {
DisableItem(fileMenu,2);
}
}
void DoEditMenu(int itemNum) {
}
void DoFileMenu(int itemNum, int* done) {
xWindow *win;
if (itemNum == 4)
*done = 1;
else if (itemNum == 1)
DoNewCommand();
else if (itemNum == 2 && xWindow::Window2XWindow(FrontWindow(),&win))
win->Close();
}
void DoOtherMenu(int menuID, int itemNum) {
}
void ApplicationIdle(void) {
}
void CleanUpApplication(void) {
}
void AboutBox(void) {
ParamText( "\pGeneric Application",
"\pDavid Eck",
"\pHobart and William Smith College, Geneva NY",
"\pThis program can be used as a shell for creating Macintosh Applications.");
Alert(128,0L);
}
void DoNewCommand(void) {
myWindow *win;
win = new myWindow;
win->Open("\pSample Window");
}